/**
 * Copyrights Christophe Cornu 2010, All rights reserved.
 */
package com.cctl.speaker;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

import com.cctl.speaker.Speaker.Result;
import com.cctl.speaker.match.Match1;

public class Console {
public static void main(String[] args) {
	String path = "D:/chrix/work/RTC-ExpressC-Full-1.0.1-Win/workspace/Speaker/src/17489-8.txt";
	Book book = new Book();
	Map<String, String> dictionary = new HashMap<String, String>();
	Set<Sentence> sentences = new HashSet<Sentence>();
	book.parseFile(path, dictionary, sentences);
	
	Speaker speaker = new Speaker();
	speaker.book = sentences;
	speaker.dictionary = dictionary;
	Scanner in = new Scanner(System.in);
	while (true) {
		String line = in.nextLine();
		String[] words = line.split(" ");
		List<Result> results = speaker.getMatches(new Match1(), new Sentence(words, speaker.dictionary, false));
		int a = 0;
		for (Result result : results) {
			System.out.println(result);
			a++;
			if (a > 5)
				break;
		}
		
	}
}
}
